#include <string>
#include <cstdlib>
#include <QString>
#include <string>
#include <map>

using namespace std;

#include "gameboard.h"
#include "Territory.h"
#include "Region.h"
#include "cards.h"
#include "ui_gameboard.h"


#define T_BeebeHouse    "Beebe's House";
#define T_Burbs         "Burbs";
#define T_Downtown      "Downtown";
#define T_Transfer      "Transfer";
#define T_ALounge       "A Lounge";
#define T_EastEmerson   "East Emerson";
#define T_WestEmerson   "West Emerson";
#define T_Page          "Page";
#define T_PageMPR       "Page MPR";
#define T_PostOffice    "Post Office";
#define T_Kerrwood      "Kerrwood";
#define T_Library       "Library";
#define T_Gardens       "Gardens";
#define T_Wittier       "Wittier";
#define T_PorterHall    "Porter Hall";
#define T_MusicBuilding "Music Building";
#define T_PrayerChapel  "Prayer Chapel";
#define T_DTRPond       "DTR Pond";
#define T_PorterCenter  "Porter Center";
#define T_KSC           "KSC";
#define T_Founders      "Founders";
#define T_DC            "DC";
#define T_Observatory   "Observatory";
#define T_WestVK        "West VK";
#define T_EastVK        "East VK";
#define T_Baseball      "Baseball";
#define T_Track         "Track";
#define T_TrackHouse    "Track House";
#define T_MRooms        "M Rooms";
#define T_Gym           "Gym";
#define T_Pool          "Pool";
#define T_PhysicalPlant "Physical Plant";
#define T_Reynolds      "Reynolds";
#define T_HealthCenter  "Health Center";
#define T_WestArmington "West Armington";
#define T_CLounge       "C Lounge";
#define T_EastArmington "East Armington";
#define T_Deane         "Deane";
#define T_Art           "Art";
#define T_TennisCourts  "Tennis Courts";



GameBoard::GameBoard(QWidget *parent)
    : QMainWindow(parent), m_ui(new Ui::GameBoardClass)
{
    m_ui->setupUi(this);

    //Set up the UI with connections between pointers and widgets for future manipulation
    connect(m_ui->btnBeebe, SIGNAL(clicked()), this, SLOT(BeebeClicked()));
    connect(m_ui->btnBurbs, SIGNAL(clicked()), this, SLOT(BurbsClicked()));
    connect(m_ui->btnDowntown, SIGNAL(clicked()), this, SLOT(DowntownClicked()));
    connect(m_ui->btnTransfer, SIGNAL(clicked()), this, SLOT(TransferClicked()));
    connect(m_ui->btnALounge, SIGNAL(clicked()), this, SLOT(ALoungeClicked()));
    connect(m_ui->btnEEmerson, SIGNAL(clicked()), this, SLOT(EEmersonClicked()));
    connect(m_ui->btnWEmerson, SIGNAL(clicked()), this, SLOT(WEmersonClicked()));
    connect(m_ui->btnPage, SIGNAL(clicked()), this, SLOT(PageClicked()));
    connect(m_ui->btnPageMPR, SIGNAL(clicked()), this, SLOT(PageMPRClicked()));
    connect(m_ui->btnPostOffice, SIGNAL(clicked()), this, SLOT(PostOfficeClicked()));
    connect(m_ui->btnKerrwood, SIGNAL(clicked()), this, SLOT(KerrwoodClicked()));
    connect(m_ui->btnLibrary, SIGNAL(clicked()), this, SLOT(LibraryClicked()));
    connect(m_ui->btnGardens, SIGNAL(clicked()), this, SLOT(GardensClicked()));
    connect(m_ui->btnWittier, SIGNAL(clicked()), this, SLOT(WittierClicked()));
    connect(m_ui->btnPorterHall, SIGNAL(clicked()), this, SLOT(PorterHClicked()));
    connect(m_ui->btnMusicBuilding, SIGNAL(clicked()), this, SLOT(MusicClicked()));
    connect(m_ui->btnPrayerChapel, SIGNAL(clicked()), this, SLOT(PrayerChapelClicked()));
    //connect(m_ui->btnDTRPond, SIGNAL(clicked()), this, SLOT(DTRClicked()));
    connect(m_ui->btnPorterCenter, SIGNAL(clicked()), this, SLOT(PorterCClicked()));
    connect(m_ui->btnKSC, SIGNAL(clicked()), this, SLOT(KSCClicked()));
    connect(m_ui->btnFounders, SIGNAL(clicked()), this, SLOT(FoundersClicked()));
    connect(m_ui->btnDC, SIGNAL(clicked()), this, SLOT(DCClicked()));
    connect(m_ui->btnObservatory, SIGNAL(clicked()), this, SLOT(ObservatoryClicked()));
    connect(m_ui->btnWVK, SIGNAL(clicked()), this, SLOT(WVKClicked()));
    connect(m_ui->btnEVK, SIGNAL(clicked()), this, SLOT(EVKClicked()));
    connect(m_ui->btnBaseball, SIGNAL(clicked()), this, SLOT(BaseballClicked()));
    connect(m_ui->btnTrack, SIGNAL(clicked()), this, SLOT(TrackClicked()));
    connect(m_ui->btnTrackHouse, SIGNAL(clicked()), this, SLOT(TrackHouse()));
    connect(m_ui->btnMRooms, SIGNAL(clicked()), this, SLOT(MRoomsClicked()));
    connect(m_ui->btnGym, SIGNAL(clicked()), this, SLOT(GymClicked()));
    connect(m_ui->btnPool, SIGNAL(clicked()), this, SLOT(PoolClicked()));
    connect(m_ui->btnPhysPlant, SIGNAL(clicked()), this, SLOT(PhysPlantClicked()));
    connect(m_ui->btnReynolds, SIGNAL(clicked()), this, SLOT(ReynoldsClicked()));
    connect(m_ui->btnHealthCenter, SIGNAL(clicked()), this, SLOT(HealthClicked()));
    connect(m_ui->btnWArmington, SIGNAL(clicked()), this, SLOT(WArmClicked()));
    connect(m_ui->btnCLounge, SIGNAL(clicked()), this, SLOT(CLoungeClicked()));
    connect(m_ui->btnEArmington, SIGNAL(clicked()), this, SLOT(EArmClicked()));
    connect(m_ui->btnDeane, SIGNAL(clicked()), this, SLOT(DeaneClicked()));
    connect(m_ui->btnArt, SIGNAL(clicked()), this, SLOT(ArtClicked()));
    connect(m_ui->btnTennis, SIGNAL(clicked()), this, SLOT(TennisClicked()));

    connect(m_ui->btnNext, SIGNAL(clicked()), this, SLOT(nextClicked()));
    connect(m_ui->btnRoll, SIGNAL(clicked()), this, SLOT(rollClicked()));
    connect(m_ui->btnRollStop, SIGNAL(clicked()), this, SLOT(stopRollClicked()));
    connect(m_ui->btnMoveRmies, SIGNAL(clicked()), this, SLOT(selectNumArmies()));
    connect(m_ui->sldrNumArmies, SIGNAL(valueChanged(int)), this, SLOT(showNumMoveArmy(int)));
    connect(m_ui->btnTurnInCards, SIGNAL(clicked()), this, SLOT(turnInCardsClicked()));

    connect(m_ui->btnCard1, SIGNAL(clicked()), this, SLOT(CardClicked_1()));
    connect(m_ui->btnCard2, SIGNAL(clicked()), this, SLOT(CardClicked_2()));
    connect(m_ui->btnCard3, SIGNAL(clicked()), this, SLOT(CardClicked_3()));
    connect(m_ui->btnCard4, SIGNAL(clicked()), this, SLOT(CardClicked_4()));
    connect(m_ui->btnCard5, SIGNAL(clicked()), this, SLOT(CardClicked_5()));

    //m_currentPlayer = m_ui->lblCurrentPlayer;
    m_territory = m_ui->lblTerritory;
    m_region = m_ui->lblRegions;

    m_teTerr = m_ui->teTerritories;
    m_teRegion = m_ui->teRegions;


    //m_ViewCards = m_ui->btnViewCards;
    m_Next = m_ui->btnNext;

    //Actions
    m_Actions = m_ui->grpActions;


    m_Roll = m_ui->grpRoll;
    m_btnRoll = m_ui->btnRoll;

    m_MoveArmy = m_ui->grpMoveArmies;
    m_btnMoveArmies = m_ui->btnMoveRmies;
    m_numArmies = m_ui->sldrNumArmies;

    m_ui->sldrNumArmies->setDisabled(true);
    m_ui->lblNumArmies->setDisabled(true);

    CreateTerritories();
    LinkTerritories();
    CreateRegions();
    CreateCards();
    CreateDeck();

    QPixmap backCard(":/images/Back of Cards.bmp");
    m_CardBack = backCard;

    QPixmap blank(":/images/blank.bmp");
    m_blank = blank;

    QPixmap rd1(":/images/Red Die 1.bmp");
    m_RD1 = rd1;

    QPixmap rd2(":/images/Red Die 2.bmp");
    m_RD2 = rd2;

    QPixmap rd3(":/images/Red Die 3.bmp");
    m_RD3 = rd3;

    QPixmap rd4(":/images/Red Die 4.bmp");
    m_RD4 = rd4;

    QPixmap rd5(":/images/Red Die 5.bmp");
    m_RD5 = rd5;

    QPixmap rd6(":/images/Red Die 6.bmp");
    m_RD6 = rd6;

    QPixmap wd1(":/images/White Die 1.bmp");
    m_WD1 = wd1;

    QPixmap wd2(":/images/White Die 2.bmp");
    m_WD2 = wd2;

    QPixmap wd3(":/images/White Die 3.bmp");
    m_WD3 = wd3;

    QPixmap wd4(":/images/White Die 4.bmp");
    m_WD4 = wd4;

    QPixmap wd5(":/images/White die 5.bmp");
    m_WD5 = wd5;

    QPixmap wd6(":/images/White Die 6.bmp");
    m_WD6 = wd6;

    QPixmap red(":/images/red_marker.bmp");
    m_Red = red;

    QPixmap orange(":/images/orange_marker.bmp");
    m_Orange = orange;

    QPixmap yellow(":/images/yellow_marker.bmp");
    m_Yellow = yellow;

    QPixmap green(":/images/green_marker.bmp");
    m_Green = green;

    QPixmap blue(":/images/blue_marker.bmp");
    m_Blue = blue;

    QPixmap purple(":/images/purple_marker.bmp");
    m_Purple = purple;

    QPixmap shuttle(":/images/Shuttle.bmp");
    m_Shuttle = shuttle;

    QPixmap freshman(":/images/freshman card.bmp");
    m_Freshman = freshman;

    QPixmap golf(":/images/Golf-Cart.bmp");
    m_GolfCart = golf;

    QPixmap all(":/images/Fresh Golf Shuttle card.bmp");
    m_All = all;

}

GameBoard::~GameBoard()
{
    delete m_ui;

    for(unsigned int n = 0;n < m_players.size();++n)
    {
        delete m_players[n];
    }
    for(unsigned int n = 0;n < m_Deck.size();++n)
    {
        delete m_Deck[n];
    }
    for(unsigned int n = 0;n < m_regions.size();++n)
    {
        delete m_regions[n];
    }
}

void GameBoard::setPlayers(vector<Player*> players)
{
    m_players = players;
    emit playCreateComp();
}

void GameBoard::CreateTerritories()
{
    m_BeebeHouse    = new Territory();
    m_Burbs         = new Territory();
    m_Downtown      = new Territory();
    m_Transfer      = new Territory();
    m_ALounge       = new Territory();
    m_EastEmerson   = new Territory();
    m_WestEmerson   = new Territory();
    m_Page          = new Territory();
    m_PageMPR       = new Territory();
    m_PostOffice    = new Territory();
    m_Kerrwood      = new Territory();
    m_Library       = new Territory();
    m_Gardens       = new Territory();
    m_Wittier       = new Territory();
    m_PorterHall    = new Territory();
    m_MusicBuilding = new Territory();
    m_PrayerChapel  = new Territory();
//    m_DTRPond       = new Territory();
    m_PorterCenter  = new Territory();
    m_KSC           = new Territory();
    m_Founders      = new Territory();
    m_DC            = new Territory();
    m_Observatory   = new Territory();
    m_WestVK        = new Territory();
    m_EastVK        = new Territory();
    m_Baseball      = new Territory();
    m_Track         = new Territory();
    m_TrackHouse    = new Territory();
    m_MRooms        = new Territory();
    m_Gym           = new Territory();
    m_Pool          = new Territory();
    m_PhysicalPlant = new Territory();
    m_Reynolds      = new Territory();
    m_HealthCenter  = new Territory();
    m_WestArmington = new Territory();
    m_CLounge       = new Territory();
    m_EastArmington = new Territory();
    m_Deane         = new Territory();
    m_Art           = new Territory();
    m_TennisCourts  = new Territory();

    //Set names

    m_BeebeHouse->setName(QString("Beebe's House"));
    m_Burbs->setName(QString("Clark Burbs"));
    m_Downtown->setName(QString("Clark Downtown"));
    m_Transfer->setName(QString("Clark Transfer Section"));
    m_ALounge->setName(QString("Clark Lounge"));
    m_EastEmerson->setName(QString("East Emerson"));
    m_WestEmerson->setName(QString("West Emerson"));
    m_Page->setName(QString("Page"));
    m_PageMPR->setName(QString("Page MPR"));
    m_PostOffice->setName(QString("Post Office"));
    m_Kerrwood->setName(QString("Kerrwood"));
    m_Library->setName(QString("Library"));
    m_Gardens->setName(QString("Formal Garden"));
    m_Wittier->setName(QString("Wittier Hall"));
    m_PorterHall->setName(QString("Porter Hall"));
    m_MusicBuilding->setName(QString("Music Building"));
    m_PrayerChapel->setName(QString("Prayer Chapel"));
//    m_DTRPond->setName(QString("DTR Pond"));
    m_PorterCenter->setName(QString("Porter Center"));
    m_KSC->setName(QString("Kerr Student Center"));
    m_Founders->setName(QString("Founder's Dining Room"));
    m_DC->setName(QString("Dining Commons"));
    m_Observatory->setName(QString("Observatory"));
    m_WestVK->setName(QString("West Van Kampen"));
    m_EastVK->setName(QString("East Van Kampen"));
    m_Baseball->setName(QString("Baseball Field"));
    m_Track->setName(QString("Track"));
    m_TrackHouse->setName(QString("Track House"));
    m_MRooms->setName(QString("Gym Classrooms"));
    m_Gym->setName(QString("Gym"));
    m_Pool->setName(QString("Pool"));
    m_PhysicalPlant->setName(QString("Physical Plant"));
    m_Reynolds->setName(QString("Reynold's Hall"));
    m_HealthCenter->setName(QString("Health Center"));
    m_WestArmington->setName(QString("West Armington"));
    m_CLounge->setName(QString("Armington Lounge"));
    m_EastArmington->setName(QString("East Armington"));
    m_Deane->setName(QString("Deane Hall"));
    m_Art->setName(QString("Art Building"));
    m_TennisCourts->setName(QString("Tennis Courts"));
}

void GameBoard::LinkTerritories()
{
    m_BeebeHouse->addNeighbor(m_Burbs);
    m_BeebeHouse->addNeighbor(m_EastEmerson);

    m_Burbs->addNeighbor(m_BeebeHouse);
    m_Burbs->addNeighbor(m_Downtown);
    m_Burbs->addNeighbor(m_ALounge);
    m_Burbs->addNeighbor(m_EastEmerson);

    m_Downtown->addNeighbor(m_Burbs);
    m_Downtown->addNeighbor(m_ALounge);
    m_Downtown->addNeighbor(m_Transfer);

    m_Transfer->addNeighbor(m_Downtown);
    m_Transfer->addNeighbor(m_ALounge);

    m_ALounge->addNeighbor(m_KSC);
    m_ALounge->addNeighbor(m_Burbs);
    m_ALounge->addNeighbor(m_Transfer);
    m_ALounge->addNeighbor(m_Downtown);

    m_EastEmerson->addNeighbor(m_Burbs);
    m_EastEmerson->addNeighbor(m_WestEmerson);
    m_EastEmerson->addNeighbor(m_PostOffice);
    m_EastEmerson->addNeighbor(m_BeebeHouse);

    m_WestEmerson->addNeighbor(m_EastEmerson);
    m_WestEmerson->addNeighbor(m_PageMPR);

    m_Page->addNeighbor(m_PageMPR);

    m_PageMPR->addNeighbor(m_Page);
    m_PageMPR->addNeighbor(m_WestEmerson);
    m_PageMPR->addNeighbor(m_PostOffice);

    m_PostOffice->addNeighbor(m_PageMPR);
    m_PostOffice->addNeighbor(m_Kerrwood);
    m_PostOffice->addNeighbor(m_Library);
    m_PostOffice->addNeighbor(m_EastEmerson);

    m_Kerrwood->addNeighbor(m_PostOffice);
    m_Kerrwood->addNeighbor(m_Library);
    m_Kerrwood->addNeighbor(m_Gardens);
    m_Kerrwood->addNeighbor(m_Founders);

    m_Library->addNeighbor(m_PostOffice);
    m_Library->addNeighbor(m_Kerrwood);
    m_Library->addNeighbor(m_Wittier);
    m_Library->addNeighbor(m_Gardens);

    m_Gardens->addNeighbor(m_Kerrwood);
    m_Gardens->addNeighbor(m_PorterCenter);
    m_Gardens->addNeighbor(m_PorterHall);
    m_Gardens->addNeighbor(m_PrayerChapel);

    m_Wittier->addNeighbor(m_Library);
    m_Wittier->addNeighbor(m_PorterHall);
    m_Wittier->addNeighbor(m_MusicBuilding);
    m_Wittier->addNeighbor(m_Baseball);

    m_PorterHall->addNeighbor(m_Wittier);
    m_PorterHall->addNeighbor(m_Gardens);
    m_PorterHall->addNeighbor(m_PrayerChapel);
    m_PorterHall->addNeighbor(m_MusicBuilding);

    m_PrayerChapel->addNeighbor(m_Observatory);
    m_PrayerChapel->addNeighbor(m_Gardens);
    m_PrayerChapel->addNeighbor(m_PorterCenter);
    m_PrayerChapel->addNeighbor(m_MusicBuilding);

    m_MusicBuilding->addNeighbor(m_Wittier);
    m_MusicBuilding->addNeighbor(m_PorterHall);
    m_MusicBuilding->addNeighbor(m_Gym);
    m_MusicBuilding->addNeighbor(m_PrayerChapel);

    m_PorterCenter->addNeighbor(m_Gardens);
    m_PorterCenter->addNeighbor(m_Observatory);
    m_PorterCenter->addNeighbor(m_PrayerChapel);
    m_PorterCenter->addNeighbor(m_Founders);

    m_Baseball->addNeighbor(m_Wittier);
    m_Baseball->addNeighbor(m_MRooms);

    m_MRooms->addNeighbor(m_Gym);
    m_MRooms->addNeighbor(m_Baseball);
    m_MRooms->addNeighbor(m_Pool);
    m_MRooms->addNeighbor(m_Track);

    m_Gym->addNeighbor(m_MRooms);
    m_Gym->addNeighbor(m_Observatory);
    m_Gym->addNeighbor(m_Pool);
    m_Gym->addNeighbor(m_MusicBuilding);

    m_Pool->addNeighbor(m_Gym);
    m_Pool->addNeighbor(m_MRooms);
    m_Pool->addNeighbor(m_Track);
    m_Pool->addNeighbor(m_PhysicalPlant);

    m_Track->addNeighbor(m_Pool);
    m_Track->addNeighbor(m_PhysicalPlant);
    m_Track->addNeighbor(m_TrackHouse);
    m_Track->addNeighbor(m_MRooms);

    m_TrackHouse->addNeighbor(m_Track);
    m_TrackHouse->addNeighbor(m_PhysicalPlant);

    m_PhysicalPlant->addNeighbor(m_TrackHouse);
    m_PhysicalPlant->addNeighbor(m_Pool);
    m_PhysicalPlant->addNeighbor(m_Track);
    m_PhysicalPlant->addNeighbor(m_TennisCourts);

    m_TennisCourts->addNeighbor(m_PhysicalPlant);
    m_TennisCourts->addNeighbor(m_Reynolds);
    m_TennisCourts->addNeighbor(m_HealthCenter);

    m_Reynolds->addNeighbor(m_WestArmington);
    m_Reynolds->addNeighbor(m_Deane);
    m_Reynolds->addNeighbor(m_TennisCourts);

    m_HealthCenter->addNeighbor(m_WestVK);
    m_HealthCenter->addNeighbor(m_TennisCourts);
    m_HealthCenter->addNeighbor(m_WestArmington);

    m_Deane->addNeighbor(m_EastArmington);
    m_Deane->addNeighbor(m_Reynolds);
    m_Deane->addNeighbor(m_Art);
    m_Deane->addNeighbor(m_WestArmington);

    m_WestArmington->addNeighbor(m_HealthCenter);
    m_WestArmington->addNeighbor(m_WestVK);
    m_WestArmington->addNeighbor(m_CLounge);
    m_WestArmington->addNeighbor(m_EastArmington);
    m_WestArmington->addNeighbor(m_Deane);

    m_CLounge->addNeighbor(m_WestArmington);
    m_CLounge->addNeighbor(m_EastArmington);

    m_EastArmington->addNeighbor(m_CLounge);
    m_EastArmington->addNeighbor(m_Art);
    m_EastArmington->addNeighbor(m_Deane);
    m_EastArmington->addNeighbor(m_WestArmington);

    m_Art->addNeighbor(m_EastArmington);
    m_Art->addNeighbor(m_Deane);

    m_WestVK->addNeighbor(m_WestArmington);
    m_WestVK->addNeighbor(m_HealthCenter);
    m_WestVK->addNeighbor(m_EastVK);
    m_WestVK->addNeighbor(m_Observatory);
    m_WestVK->addNeighbor(m_DC);

    m_EastVK->addNeighbor(m_WestVK);
    m_EastVK->addNeighbor(m_DC);

    m_Observatory->addNeighbor(m_PorterCenter);
    m_Observatory->addNeighbor(m_PrayerChapel);
    m_Observatory->addNeighbor(m_Gym);
    m_Observatory->addNeighbor(m_WestVK);

    m_DC->addNeighbor(m_WestVK);
    m_DC->addNeighbor(m_EastVK);
    m_DC->addNeighbor(m_Founders);
    m_DC->addNeighbor(m_KSC);

    m_Founders->addNeighbor(m_DC);
    m_Founders->addNeighbor(m_KSC);
    m_Founders->addNeighbor(m_PorterCenter);
    m_Founders->addNeighbor(m_Kerrwood);

    m_KSC->addNeighbor(m_DC);
    m_KSC->addNeighbor(m_Founders);
    m_KSC->addNeighbor(m_ALounge);
}

void GameBoard::CreateRegions()
{
    m_Clark = new Region(5,"Clark");
    m_Clark->addTerritory(m_BeebeHouse);
    m_Clark->addTerritory(m_Burbs);
    m_Clark->addTerritory(m_Downtown);
    m_Clark->addTerritory(m_Transfer);
    m_Clark->addTerritory(m_ALounge);

    m_PageEmerson = new Region(4,"Upper Campus");
    m_PageEmerson->addTerritory(m_EastEmerson);
    m_PageEmerson->addTerritory(m_WestEmerson);
    m_PageEmerson->addTerritory(m_Page);
    m_PageEmerson->addTerritory(m_PageMPR);

    m_Central = new Region(10,"Central Campus");
    m_Central->addTerritory(m_PostOffice);
    m_Central->addTerritory(m_Kerrwood);
    m_Central->addTerritory(m_Library);
    m_Central->addTerritory(m_Gardens);
    m_Central->addTerritory(m_Wittier);
    m_Central->addTerritory(m_PorterHall);
    m_Central->addTerritory(m_MusicBuilding);
    m_Central->addTerritory(m_PrayerChapel);
//    m_Central->addTerritory(m_DTRPond);
    m_Central->addTerritory(m_PorterCenter);

    m_Athletic = new Region(7,"Fields/Gym");
    m_Athletic->addTerritory(m_Baseball);
    m_Athletic->addTerritory(m_Track);
    m_Athletic->addTerritory(m_TrackHouse);
    m_Athletic->addTerritory(m_MRooms);
    m_Athletic->addTerritory(m_Gym);
    m_Athletic->addTerritory(m_Pool);
    m_Athletic->addTerritory(m_PhysicalPlant);

    m_Armington = new Region(8,"Armington");
    m_Armington->addTerritory(m_Reynolds);
    m_Armington->addTerritory(m_HealthCenter);
    m_Armington->addTerritory(m_EastArmington);
    m_Armington->addTerritory(m_WestArmington);
    m_Armington->addTerritory(m_CLounge);
    m_Armington->addTerritory(m_Deane);
    m_Armington->addTerritory(m_Art);
    m_Armington->addTerritory(m_TennisCourts);

    m_VKDC = new Region(6,"DC/VK");
    m_VKDC->addTerritory(m_KSC);
    m_VKDC->addTerritory(m_DC);
    m_VKDC->addTerritory(m_Founders);
    m_VKDC->addTerritory(m_Observatory);
    m_VKDC->addTerritory(m_WestVK);
    m_VKDC->addTerritory(m_EastVK);

    m_regions.push_back(m_Clark);
    m_regions.push_back(m_PageEmerson);
    m_regions.push_back(m_Central);
    m_regions.push_back(m_Athletic);
    m_regions.push_back(m_Armington);
    m_regions.push_back(m_VKDC);
}

void GameBoard::CreateCards()
{
    Territory* Joker = NULL;
    string F = "Frosh";
    string G = "GolfCart";
    string S = "Shuttle";
    string J = "Joker";

    m_cBeebeHouse    = new Cards(F,m_BeebeHouse);
    m_cBurbs         = new Cards(G,m_Burbs);
    m_cDowntown      = new Cards(S,m_Downtown);
    m_cTransfer      = new Cards(F,m_Transfer);
    m_cALounge       = new Cards(G,m_ALounge);
    m_cEastEmerson   = new Cards(S,m_EastEmerson);
    m_cWestEmerson   = new Cards(F,m_WestEmerson);
    m_cPage          = new Cards(G,m_Page);
    m_cPageMPR       = new Cards(S,m_PageMPR);
    m_cPostOffice    = new Cards(F,m_PostOffice);
    m_cKerrwood      = new Cards(G,m_Kerrwood);
    m_cLibrary       = new Cards(S,m_Library);
    m_cGardens       = new Cards(F,m_Gardens);
    m_cWittier       = new Cards(G,m_Wittier);
    m_cPorterHall    = new Cards(S,m_PorterHall);
    m_cMusicBuilding = new Cards(F,m_MusicBuilding);
    m_cPrayerChapel  = new Cards(G,m_PrayerChapel);
//    m_cDTRPond       = new Cards(S,m_DTRPond);
    m_cPorterCenter  = new Cards(F,m_PorterCenter);
    m_cKSC           = new Cards(G,m_KSC);
    m_cFounders      = new Cards(S,m_Founders);
    m_cDC            = new Cards(F,m_DC);
    m_cObservatory   = new Cards(G,m_Observatory);
    m_cWestVK        = new Cards(S,m_WestVK);
    m_cEastVK        = new Cards(F,m_EastVK);
    m_cBaseball      = new Cards(G,m_Baseball);
    m_cTrack         = new Cards(S,m_Track);
    m_cTrackHouse    = new Cards(F,m_TrackHouse);
    m_cMRooms        = new Cards(G,m_MRooms);
    m_cGym           = new Cards(S,m_Gym);
    m_cPool          = new Cards(F,m_Pool);
    m_cPhysicalPlant = new Cards(G,m_PhysicalPlant);
    m_cReynolds      = new Cards(S,m_Reynolds);
    m_cHealthCenter  = new Cards(F,m_HealthCenter);
    m_cWestArmington = new Cards(G,m_WestArmington);
    m_cCLounge       = new Cards(S,m_CLounge);
    m_cEastArmington = new Cards(F,m_EastArmington);
    m_cDeane         = new Cards(G,m_Deane);
    m_cArt           = new Cards(S,m_Art);
    m_cTennisCourts  = new Cards(F,m_TennisCourts);
    m_Joker1         = new Cards(J,Joker);
    m_Joker2         = new Cards(J,Joker);
}

void GameBoard::CreateDeck()
{
    m_Deck.push_back(m_cBeebeHouse);
    m_Deck.push_back(m_cBurbs);
    m_Deck.push_back(m_cDowntown);
    m_Deck.push_back(m_cTransfer);
    m_Deck.push_back(m_cALounge);
    m_Deck.push_back(m_cEastEmerson);
    m_Deck.push_back(m_cWestEmerson);
    m_Deck.push_back(m_cPage);
    m_Deck.push_back(m_cPageMPR);
    m_Deck.push_back(m_cPostOffice);
    m_Deck.push_back(m_cKerrwood);
    m_Deck.push_back(m_cLibrary);
    m_Deck.push_back(m_cGardens);
    m_Deck.push_back(m_cWittier);
    m_Deck.push_back(m_cPorterHall);
    m_Deck.push_back(m_cMusicBuilding);
    m_Deck.push_back(m_cPrayerChapel);
//    m_Deck.push_back(m_cDTRPond);
    m_Deck.push_back(m_cPorterCenter);
    m_Deck.push_back(m_cKSC);
    m_Deck.push_back(m_cFounders);
    m_Deck.push_back(m_cDC);
    m_Deck.push_back(m_cObservatory);
    m_Deck.push_back(m_cWestVK);
    m_Deck.push_back(m_cEastVK);
    m_Deck.push_back(m_cBaseball);
    m_Deck.push_back(m_cTrack);
    m_Deck.push_back(m_cTrackHouse);
    m_Deck.push_back(m_cMRooms);
    m_Deck.push_back(m_cGym);
    m_Deck.push_back(m_cPool);
    m_Deck.push_back(m_cPhysicalPlant);
    m_Deck.push_back(m_cReynolds);
    m_Deck.push_back(m_cHealthCenter);
    m_Deck.push_back(m_cWestArmington);
    m_Deck.push_back(m_cCLounge);
    m_Deck.push_back(m_cEastArmington);
    m_Deck.push_back(m_cDeane);
    m_Deck.push_back(m_cArt);
    m_Deck.push_back(m_cTennisCourts);
    m_Deck.push_back(m_Joker1);
    m_Deck.push_back(m_Joker2);
}

void GameBoard::UpdateUI_CurrentPlayer(Player* currentPlayer)
{
    m_ui->lblCurrentPlayer->setText(currentPlayer->getName());
    m_ui->teTerritories->clear();
    m_ui->teRegions->clear();
    if(m_ui->teTerritories->isEnabled() == false)
    {
        m_ui->teTerritories->setEnabled(true);
        m_ui->lblTerritory->setEnabled(true);
        m_ui->teRegions->setEnabled(true);
        m_ui->lblRegions->setEnabled(true);
    }
    for(unsigned int i = 0; i < currentPlayer->getTerritories().size(); ++i)
    {
        if(currentPlayer->getTerritories().at(i) == NULL)
        {
            continue;
        }
        m_ui->teTerritories->append(currentPlayer->getTerritories().at(i)->getName());
    }
    for(unsigned int i = 0;i < m_regions.size();++i)
    {
        for(unsigned int n = 0;n < m_regions[i]->getTerritories().size();++n)
        {
            if(m_regions[i]->getTerritories()[n]->getPlayer() != currentPlayer)
                break;
            if(n == m_regions[i]->getTerritories().size() - 1)
            {
                m_ui->teRegions->append(m_regions[i]->getName());
                break;
            }
        }
    }
}

void GameBoard::UpdateUI_Phase(QString phase)
{
    m_ui->lblPhase->setText(phase);
}

//Setting the Dice labels to the appropriate Pixmap depending on their value generated in controller.cpp
void GameBoard::UpdateUI_Dice1(int val)
{
   if(val == 1)
   {
       m_ui->lblDi1->setPixmap(m_RD1);
   }
   else if(val == 2)
   {
       m_ui->lblDi1->setPixmap(m_RD2);
   }
   else if(val == 3)
   {
       m_ui->lblDi1->setPixmap(m_RD3);
   }
   else if(val == 4)
   {
       m_ui->lblDi1->setPixmap(m_RD4);
   }
   else if(val == 5)
   {
       m_ui->lblDi1->setPixmap(m_RD5);
   }
   else if(val == 6)
   {
       m_ui->lblDi1->setPixmap(m_RD6);
   }
   else
   {
       m_ui->lblDi1->setPixmap(m_blank);
   }
}

void GameBoard::UpdateUI_Dice2(int val)
{
   if(val == 1)
   {
       m_ui->lblDi2->setPixmap(m_RD1);
   }
   else if(val == 2)
   {
       m_ui->lblDi2->setPixmap(m_RD2);
   }
   else if(val == 3)
   {
       m_ui->lblDi2->setPixmap(m_RD3);
   }
   else if(val == 4)
   {
       m_ui->lblDi2->setPixmap(m_RD4);
   }
   else if(val == 5)
   {
       m_ui->lblDi2->setPixmap(m_RD5);
   }
   else if(val == 6)
   {
       m_ui->lblDi2->setPixmap(m_RD6);
   }
   else
   {
       m_ui->lblDi2->setPixmap(m_blank);
   }
}

void GameBoard::UpdateUI_Dice3(int val)
{
   if(val == 1)
   {
       m_ui->lblDi3->setPixmap(m_RD1);
   }
   else if(val == 2)
   {
       m_ui->lblDi3->setPixmap(m_RD2);
   }
   else if(val == 3)
   {
       m_ui->lblDi3->setPixmap(m_RD3);
   }
   else if(val == 4)
   {
       m_ui->lblDi3->setPixmap(m_RD4);
   }
   else if(val == 5)
   {
       m_ui->lblDi3->setPixmap(m_RD5);
   }
   else if(val == 6)
   {
       m_ui->lblDi3->setPixmap(m_RD6);
   }
   else
   {
       m_ui->lblDi3->setPixmap(m_blank);
   }
}

void GameBoard::UpdateUI_Dice4(int val)
{
   if(val == 1)
   {
       m_ui->lblDi4->setPixmap(m_WD1);
   }
   else if(val == 2)
   {
       m_ui->lblDi4->setPixmap(m_WD2);
   }
   else if(val == 3)
   {
       m_ui->lblDi4->setPixmap(m_WD3);
   }
   else if(val == 4)
   {
       m_ui->lblDi4->setPixmap(m_WD4);
   }
   else if(val == 5)
   {
       m_ui->lblDi4->setPixmap(m_WD5);
   }
   else if(val == 6)
   {
       m_ui->lblDi4->setPixmap(m_WD6);
   }
   else
   {
       m_ui->lblDi4->setPixmap(m_blank);
   }
}

void GameBoard::UpdateUI_Dice5(int val)
{
   if(val == 1)
   {
       m_ui->lblDi5->setPixmap(m_WD1);
   }
   else if(val == 2)
   {
       m_ui->lblDi5->setPixmap(m_WD2);
   }
   else if(val == 3)
   {
       m_ui->lblDi5->setPixmap(m_WD3);
   }
   else if(val == 4)
   {
       m_ui->lblDi5->setPixmap(m_WD4);
   }
   else if(val == 5)
   {
       m_ui->lblDi5->setPixmap(m_WD5);
   }
   else if(val == 6)
   {
       m_ui->lblDi5->setPixmap(m_WD6);
   }
   else
   {
       m_ui->lblDi5->setPixmap(m_blank);
   }
}

void GameBoard::MapTerritories() //This is what I have, and I'm not sure how to
                                 //finish up, Tell me if this is what we need and what else!
{
    TerMap TMap;
    TMap["Beebe's House"] = 1;
    TMap["Burbs"] = 2;
    TMap["Downtown"] = 3;
    TMap["Transfer"] = 4;
    TMap["A Lounge"] = 5;
    TMap["East Emerson"] = 6;
    TMap["West Emerson"] = 7;
    TMap["Page"] = 8;
    TMap["Page MPR"] = 9;
    TMap["Post Office"] = 10;
    TMap["Kerrwood"] = 11;
    TMap["Library"] = 12;
    TMap["Gardens"] = 13;
    TMap["Wittier"] = 14;
    TMap["Porter Hall"] = 15;
    TMap["Music Building"] = 16;
    TMap["Prayer Chapel"] = 17;
    TMap["DTR Pond"] = 18;
    TMap["KSC"] = 19;
    TMap["Founders"] = 20;
    TMap["DC"] = 21;
    TMap["Observatory"] = 22;
    TMap["West VK"] = 23;
    TMap["East VK"] = 24;
    TMap["Baseball"] = 25;
    TMap["Track"] = 26;
    TMap["Track Houe"] = 27;
    TMap["M Rooms"] = 28;
    TMap["Gym"] = 29;
    TMap["Pool"] = 30;
    TMap["Physical Plant"] = 31;
    TMap["Reynolds"] = 32;
    TMap["Health Center"] = 33;
    TMap["West Armington"] = 34;
    TMap["C Lounge"] = 35;
    TMap["East Armington"] = 36;
    TMap["Deane"] = 37;
    TMap["Art"] = 38;
    TMap["Tennis Courts"] = 39;

}

void GameBoard::MapButtons()
{
    btnMap BMap;

    BMap[m_BeebeHouse]=     m_ui->btnBeebe;
    BMap[m_Burbs]=          m_ui->btnBurbs;
    BMap[m_Downtown]=       m_ui->btnDowntown;
    BMap[m_Transfer]=       m_ui->btnTransfer;
    BMap[m_ALounge]=        m_ui->btnALounge;
    BMap[m_EastEmerson]=    m_ui->btnEEmerson;
    BMap[m_WestEmerson]=    m_ui->btnWEmerson;
    BMap[m_Page]=           m_ui->btnPage;
    BMap[m_PageMPR]=        m_ui->btnPageMPR;
    BMap[m_PostOffice]=     m_ui->btnPostOffice;
    BMap[m_Kerrwood]=       m_ui->btnKerrwood;
    BMap[m_Library]=        m_ui->btnLibrary;
    BMap[m_Gardens]=        m_ui->btnGardens;
    BMap[m_Wittier]=        m_ui->btnWittier;
    BMap[m_PorterHall]=     m_ui->btnPorterHall;
    BMap[m_MusicBuilding]=  m_ui->btnMusicBuilding;
    BMap[m_PrayerChapel]=   m_ui->btnPrayerChapel;
    //BMap[m_DTRPond]=        m_ui->btnDTRPond;
    BMap[m_PorterCenter]=   m_ui->btnPorterCenter;
    BMap[m_KSC]=            m_ui->btnKSC;
    BMap[m_Founders]=       m_ui->btnFounders;
    BMap[m_DC]=             m_ui->btnDC;
    BMap[m_Observatory]=    m_ui->btnObservatory;
    BMap[m_EastVK]=         m_ui->btnWVK;
    BMap[m_WestVK]=         m_ui->btnEVK;
    BMap[m_Baseball]=       m_ui->btnBaseball;
    BMap[m_Track]=          m_ui->btnTrack;
    BMap[m_TrackHouse]=     m_ui->btnTrackHouse;
    BMap[m_MRooms]=         m_ui->btnMRooms;
    BMap[m_Gym]=            m_ui->btnGym;
    BMap[m_Pool]=           m_ui->btnPool;
    BMap[m_PhysicalPlant]=  m_ui->btnPhysPlant;
    BMap[m_Reynolds]=       m_ui->btnReynolds;
    BMap[m_HealthCenter]=   m_ui->btnHealthCenter;
    BMap[m_WestArmington]=  m_ui->btnWArmington;
    BMap[m_CLounge]=        m_ui->btnCLounge;
    BMap[m_EastArmington]=  m_ui->btnEArmington;
    BMap[m_Deane]=          m_ui->btnDeane;
    BMap[m_Art]=            m_ui->btnArt;
    BMap[m_TennisCourts]=   m_ui->btnTennis;
}

//Clicked Territory Signals
void GameBoard::BeebeClicked()
{
    emit selectedTerritory(m_BeebeHouse);

}
void GameBoard::BurbsClicked()
{
    emit selectedTerritory(m_Burbs);

}
void GameBoard::DowntownClicked()
{
    emit selectedTerritory(m_Downtown);

}
void GameBoard::TransferClicked()
{
    emit selectedTerritory(m_Transfer);

}
void GameBoard::ALoungeClicked()
{
    emit selectedTerritory(m_ALounge);

}
void GameBoard::EEmersonClicked()
{
    emit selectedTerritory(m_EastEmerson);

}
void GameBoard::WEmersonClicked()
{
    emit selectedTerritory(m_WestEmerson);

}
void GameBoard::PageClicked()
{
    emit selectedTerritory(m_Page);

}
void GameBoard::PageMPRClicked()
{
    emit selectedTerritory(m_PageMPR);

}
void GameBoard::PostOfficeClicked()
{
    emit selectedTerritory(m_PostOffice);

}
void GameBoard::KerrwoodClicked()
{
    emit selectedTerritory(m_Kerrwood);

}
void GameBoard::LibraryClicked()
{
    emit selectedTerritory(m_Library);

}
void GameBoard::GardensClicked()
{
    emit selectedTerritory(m_Gardens);

}
void GameBoard::WittierClicked()
{
    emit selectedTerritory(m_Wittier);

}
void GameBoard::PorterHClicked()
{
    emit selectedTerritory(m_PorterHall);

}
void GameBoard::MusicClicked()
{
    emit selectedTerritory(m_MusicBuilding);

}
void GameBoard::PrayerChapelClicked()
{
    emit selectedTerritory(m_PrayerChapel);

}
void GameBoard::DTRClicked()
{
    //deleted
}
void GameBoard::PorterCClicked()
{
    emit selectedTerritory(m_PorterCenter);

}
void GameBoard::KSCClicked()
{
    emit selectedTerritory(m_KSC);

}
void GameBoard::FoundersClicked()
{
    emit selectedTerritory(m_Founders);

}
void GameBoard::DCClicked()
{
    emit selectedTerritory(m_DC);

}
void GameBoard::ObservatoryClicked()
{
    emit selectedTerritory(m_Observatory);

}
void GameBoard::WVKClicked()
{
    emit selectedTerritory(m_WestVK);

}
void GameBoard::EVKClicked()
{
    emit selectedTerritory(m_EastVK);

}
void GameBoard::BaseballClicked()
{
    emit selectedTerritory(m_Baseball);

}
void GameBoard::TrackClicked()
{
    emit selectedTerritory(m_Track);

}
void GameBoard::TrackHouse()
{
    emit selectedTerritory(m_TrackHouse);

}
void GameBoard::MRoomsClicked()
{
    emit selectedTerritory(m_MRooms);

}
void GameBoard::GymClicked()
{
    emit selectedTerritory(m_Gym);

}
void GameBoard::PoolClicked()
{
    emit selectedTerritory(m_Pool);

}
void GameBoard::PhysPlantClicked()
{
    emit selectedTerritory(m_PhysicalPlant);

}
void GameBoard::ReynoldsClicked()
{
    emit selectedTerritory(m_Reynolds);

}
void GameBoard::HealthClicked()
{
    emit selectedTerritory(m_HealthCenter);

}
void GameBoard::WArmClicked()
{
    emit selectedTerritory(m_WestArmington);

}
void GameBoard::CLoungeClicked()
{
    emit selectedTerritory(m_CLounge);

}
void GameBoard::EArmClicked()
{
    emit selectedTerritory(m_EastArmington);

}
void GameBoard::DeaneClicked()
{
    emit selectedTerritory(m_Deane);

}
void GameBoard::ArtClicked()
{
    emit selectedTerritory(m_Art);
}

void GameBoard::TennisClicked()
{
    emit selectedTerritory(m_TennisCourts);
}

//Sidebar Buttons
void GameBoard::nextClicked()
{
    emit nextBtn();
}

void GameBoard::rollClicked()
{
    emit rollBtn();
}

void GameBoard::stopRollClicked()
{
    emit stopRollBtn();
}

void GameBoard::selectNumArmies()
{
    emit numArmiesChosen();
}

int GameBoard::movingArmies()
{
    return m_ui->sldrNumArmies->value();
}

void GameBoard::turnInCardsClicked()
{
    emit turnInCardsBtn();
}

void GameBoard::UpDateUI_TerritoryColor(Player* player, Territory* territory)
{
    //Map territory
    //map<Territory*
    //Get proper btn

    QLabel* lblTerritory;

    if(territory == m_BeebeHouse)
    {lblTerritory = m_ui->lblBeebe;}
    else if(territory == m_Burbs)
    {lblTerritory = m_ui->lblBurbs;}
    else if(territory == m_Downtown)
    {lblTerritory = m_ui->lblDowntown;}
    else if(territory == m_Transfer)
    {lblTerritory = m_ui->lblTransfer;}
    else if(territory == m_ALounge)
    {lblTerritory = m_ui->lblALounge;}
    else if(territory == m_EastEmerson)
    {lblTerritory = m_ui->lblEEmerson;}
    else if(territory == m_WestEmerson)
    {lblTerritory = m_ui->lblWEmerson;}
    else if(territory == m_Page)
    {lblTerritory = m_ui->lblPage;}
    else if(territory == m_PageMPR)
    {lblTerritory = m_ui->lblPageMPR;}
    else if(territory == m_PostOffice)
    {lblTerritory = m_ui->lblPostOffice;}
    else if(territory == m_Kerrwood)
    {lblTerritory = m_ui->lblKerrwood;}
    else if(territory == m_Library)
    {lblTerritory = m_ui->lblLibrary;}
    else if(territory == m_Gardens)
    {lblTerritory = m_ui->lblGardens;}
    else if(territory == m_Wittier)
    {lblTerritory = m_ui->lblWittier;}
    else if(territory == m_PorterHall)
    {lblTerritory = m_ui->lblPorterHall;}
    else if(territory == m_MusicBuilding)
    {lblTerritory = m_ui->lblMusic;}
    else if(territory == m_PrayerChapel)
    {lblTerritory = m_ui->lblPrayerChapel;}
    else if(territory == m_PorterCenter)
    {lblTerritory = m_ui->lblPorterCenter;}
    else if(territory == m_KSC)
    {lblTerritory = m_ui->lblFounders;}
    else if(territory == m_Founders)
    {lblTerritory = m_ui->lblDC;}
    else if(territory == m_DC)
    {lblTerritory = m_ui->lblKSC;}
    else if(territory == m_Observatory)
    {lblTerritory = m_ui->lblObservatory;}
    else if(territory == m_WestVK)
    {lblTerritory = m_ui->lblWVK;}
    else if(territory == m_EastVK)
    {lblTerritory = m_ui->lblEVK;}
    else if(territory == m_Baseball)
    {lblTerritory = m_ui->lblBaseball;}
    else if(territory == m_Track)
    {lblTerritory = m_ui->lblTrack;}
    else if(territory == m_TrackHouse)
    {lblTerritory = m_ui->lblTrackHouse;}
    else if(territory == m_MRooms)
    {lblTerritory = m_ui->lblMRooms;}
    else if(territory == m_Gym)
    {lblTerritory = m_ui->lblGym;}
    else if(territory == m_Pool)
    {lblTerritory = m_ui->lblPool;}
    else if(territory == m_PhysicalPlant)
    {lblTerritory = m_ui->lblPhysicalPlant;}
    else if(territory == m_Reynolds)
    {lblTerritory = m_ui->lblReynolds;}
    else if(territory == m_HealthCenter)
    {lblTerritory = m_ui->lblHealthCenter;}
    else if(territory == m_WestArmington)
    {lblTerritory = m_ui->lblWArm;}
    else if(territory == m_CLounge)
    {lblTerritory = m_ui->lblCLounge;}
    else if(territory == m_EastArmington)
    {lblTerritory = m_ui->lblEArm;}
    else if(territory == m_Deane)
    {lblTerritory = m_ui->lblDeane;}
    else if(territory == m_Art)
    {lblTerritory = m_ui->lblArt;}
    else if(territory == m_TennisCourts)
    {lblTerritory = m_ui->lblTennisCourts;}

    //lblTerritory->d

    //if player is red
    if(player->getColor() == "Red")
    {
        lblTerritory->setPixmap(m_Red);
    }
    else if(player->getColor() == "Orange")
    {
        lblTerritory->setPixmap(m_Orange);
    }
    else if(player->getColor() == "Yellow")
    {
        lblTerritory->setPixmap(m_Yellow);
    }
    else if(player->getColor() == "Green")
    {
        lblTerritory->setPixmap(m_Green);
    }
    else if(player->getColor() == "Blue")
    {
        lblTerritory->setPixmap(m_Blue);
    }
    else if(player->getColor() == "Purple")
    {
        lblTerritory->setPixmap(m_Purple);
    }
}

void GameBoard::CardClicked_1()
{
    Cards* clicked;
    if(m_CurrentPlayer->getCards().size() > 0)
    {
        clicked = m_CurrentPlayer->getCards().at(0);
        emit selectedCard(clicked);
    }
}

void GameBoard::CardClicked_2()
{
    Cards* clicked;
    if(m_CurrentPlayer->getCards().size() > 1)
    {
        clicked = m_CurrentPlayer->getCards().at(1);
        emit selectedCard(clicked);
    }
}

void GameBoard::CardClicked_3()
{
    Cards* clicked;
    if(m_CurrentPlayer->getCards().size() > 2)
    {
        clicked = m_CurrentPlayer->getCards().at(2);
        emit selectedCard(clicked);
    }
}

void GameBoard::CardClicked_4()
{
    Cards* clicked;
    if(m_CurrentPlayer->getCards().size() > 3)
    {
        clicked = m_CurrentPlayer->getCards().at(3);
        emit selectedCard(clicked);
    }
}

void GameBoard::CardClicked_5()
{
    Cards* clicked;
    if(m_CurrentPlayer->getCards().size() > 4)
    {
        clicked = m_CurrentPlayer->getCards().at(4);
        emit selectedCard(clicked);
    }
}

//A function that allows player to "view" cards, by changing the icons on the cards
void GameBoard::ViewCards(Player* CurrentPlayer)
{
    m_CurrentPlayer = CurrentPlayer;
    for (unsigned int i = 0; i < CurrentPlayer->getCards().size(); ++i)
    {
        Cards* card = CurrentPlayer->getCards().at(i);

        if(card == NULL)
        {
           continue;
        }
        else if(card->getType() == 0)
        {
            if(i == 0)
            {
                m_ui->lblCard1->setPixmap(m_Freshman);
            }
            else if (i == 1)
            {
                m_ui->lblCard2->setPixmap(m_Freshman);
            }
            else if (i == 2)
            {
                m_ui->lblCard3->setPixmap(m_Freshman);
            }
            else if (i == 3)
            {
                 m_ui->lblCard4->setPixmap(m_Freshman);
            }
            else if (i == 4)
            {
                m_ui->lblCard5->setPixmap(m_Freshman);
            }
        }
        else if (card->getType() == 1)
        {
            if(i == 0)
            {
                m_ui->lblCard1->setPixmap(m_GolfCart);
            }
            else if (i == 1)
            {
                m_ui->lblCard2->setPixmap(m_GolfCart);
            }
            else if (i == 2)
            {
                m_ui->lblCard3->setPixmap(m_GolfCart);
            }
            else if (i == 3)
            {
                m_ui->lblCard4->setPixmap(m_GolfCart);
            }
            else if (i == 4)
            {
                m_ui->lblCard5->setPixmap(m_GolfCart);
            }
        }
        else if (card->getType() == 2)
        {
            if(i == 0)
            {
                m_ui->lblCard1->setPixmap(m_Shuttle);
            }
            else if (i == 1)
            {
                m_ui->lblCard2->setPixmap(m_Shuttle);
            }
            else if (i == 2)
            {
                m_ui->lblCard3->setPixmap(m_Shuttle);
            }
            else if (i == 3)
            {
                m_ui->lblCard4->setPixmap(m_Shuttle);
            }
            else if (i == 4)
            {
                m_ui->lblCard5->setPixmap(m_Shuttle);
            }
        }
        else if (card->getType() == 3)
        {
            if(i == 0)
            {
                m_ui->lblCard1->setPixmap(m_All);
            }
            else if (i == 1)
            {
                m_ui->lblCard2->setPixmap(m_All);
            }
            else if (i == 2)
            {
                m_ui->lblCard3->setPixmap(m_All);
            }
            else if (i == 3)
            {
                m_ui->lblCard4->setPixmap(m_All);
            }
            else if (i == 4)
            {
                m_ui->lblCard5->setPixmap(m_All);
            }
        }
    }
}

void GameBoard::HideCards()
{
    m_ui->lblCard1->setPixmap(m_CardBack);
    m_ui->lblCard2->setPixmap(m_CardBack);
    m_ui->lblCard3->setPixmap(m_CardBack);
    m_ui->lblCard4->setPixmap(m_CardBack);
    m_ui->lblCard5->setPixmap(m_CardBack);
    m_CurrentPlayer = NULL;
}

void GameBoard::showNumMoveArmy(int value)
{
    QString text;
    m_ui->lblNumArmies->setText(text.setNum(value));
}

void GameBoard::setSliderNum(Territory* ter)
{
    if(m_ui->sldrNumArmies->isEnabled() == false)
    {
        m_ui->sldrNumArmies->setEnabled(true);
        m_ui->lblNumArmies->setEnabled(true);
    }
    m_ui->sldrNumArmies->setMaximum(ter->getStrength() - 1);
}

void GameBoard::UpdateUI_TerritoryReinforcements(Territory* territory)
{
    QLabel* lblTerritory;

    if(territory == m_BeebeHouse)
    {lblTerritory = m_ui->lbl1Beebe;}
    else if(territory == m_Burbs)
    {lblTerritory = m_ui->lbl1Burbs;}
    else if(territory == m_Downtown)
    {lblTerritory = m_ui->lbl1Downtown;}
    else if(territory == m_Transfer)
    {lblTerritory = m_ui->lbl1Transfer;}
    else if(territory == m_ALounge)
    {lblTerritory = m_ui->lbl1ALounge;}
    else if(territory == m_EastEmerson)
    {lblTerritory = m_ui->lbl1EEmerson;}
    else if(territory == m_WestEmerson)
    {lblTerritory = m_ui->lbl1WEmerson;}
    else if(territory == m_Page)
    {lblTerritory = m_ui->lbl1Page;}
    else if(territory == m_PageMPR)
    {lblTerritory = m_ui->lbl1PageMPR;}
    else if(territory == m_PostOffice)
    {lblTerritory = m_ui->lbl1PostOffice;}
    else if(territory == m_Kerrwood)
    {lblTerritory = m_ui->lbl1Kerrwood;}
    else if(territory == m_Library)
    {lblTerritory = m_ui->lbl1Library;}
    else if(territory == m_Gardens)
    {lblTerritory = m_ui->lbl1Gardens;}
    else if(territory == m_Wittier)
    {lblTerritory = m_ui->lbl1Wittier;}
    else if(territory == m_PorterHall)
    {lblTerritory = m_ui->lbl1PorterHall;}
    else if(territory == m_MusicBuilding)
    {lblTerritory = m_ui->lbl1Music;}
    else if(territory == m_PrayerChapel)
    {lblTerritory = m_ui->lbl1PrayerChapel;}
    else if(territory == m_PorterCenter)
    {lblTerritory = m_ui->lbl1PorterCenter;}
    else if(territory == m_KSC)
    {lblTerritory = m_ui->lbl1KSC;}
    else if(territory == m_Founders)
    {lblTerritory = m_ui->lbl1Founders;}
    else if(territory == m_DC)
    {lblTerritory = m_ui->lbl1DC;}
    else if(territory == m_Observatory)
    {lblTerritory = m_ui->lbl1Observatory;}
    else if(territory == m_WestVK)
    {lblTerritory = m_ui->lbl1WVK;}
    else if(territory == m_EastVK)
    {lblTerritory = m_ui->lbl1EVK;}
    else if(territory == m_Baseball)
    {lblTerritory = m_ui->lbl1Baseball;}
    else if(territory == m_Track)
    {lblTerritory = m_ui->lbl1Track;}
    else if(territory == m_TrackHouse)
    {lblTerritory = m_ui->lbl1TrackHouse;}
    else if(territory == m_MRooms)
    {lblTerritory = m_ui->lbl1MRooms;}
    else if(territory == m_Gym)
    {lblTerritory = m_ui->lbl1Gym;}
    else if(territory == m_Pool)
    {lblTerritory = m_ui->lbl1Pool;}
    else if(territory == m_PhysicalPlant)
    {lblTerritory = m_ui->lbl1PhysicalPlant;}
    else if(territory == m_Reynolds)
    {lblTerritory = m_ui->lbl1Reynolds;}
    else if(territory == m_HealthCenter)
    {lblTerritory = m_ui->lbl1HealthCenter;}
    else if(territory == m_WestArmington)
    {lblTerritory = m_ui->lbl1WArm;}
    else if(territory == m_CLounge)
    {lblTerritory = m_ui->lbl1CLounge;}
    else if(territory == m_EastArmington)
    {lblTerritory = m_ui->lbl1EArm;}
    else if(territory == m_Deane)
    {lblTerritory = m_ui->lbl1Deane;}
    else if(territory == m_Art)
    {lblTerritory = m_ui->lbl1Art;}
    else if(territory == m_TennisCourts)
    {lblTerritory = m_ui->lbl1TennisCourts;}

    lblTerritory->setNum(territory->getStrength());
}
